//
//  NSString+HYRegularExepressions.m
//  Object-CPlayGround
//
//  Created by 韩丛旸 on 16/8/3.
//  Copyright © 2016年 韩丛旸. All rights reserved.
//

#import "NSString+HYRegularExepressions.h"

@implementation NSString (HYRegularExepressions)

- (BOOL)isUnicodeChar:(NSString *)string
{
    return [self checkRegularExepressions:@"^[\x21-\x7e]*$" withCheckString:string];
}

- (BOOL)checkRegularExepressions:(NSString *)regex withCheckString:(NSString *)checkString
{
    NSParameterAssert(regex);
    NSParameterAssert(checkString);

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];

    return [predicate evaluateWithObject:checkString];
}

@end
